/**
 * @author casazaft
 */
Package("j2j.effect.dnd").Class("DragProxy", {
    DragProxy: function(config){
        this.type = config.type;
        var _this;
        config.useCache = (config.useCache === undefined) ? true : false;
        config.properties = config.properties || this.defaultProperties;
        _this = this._proxyBuilder.cache.retrieval(this.type);
        if (_this && config.useCache) {
            return _this;
        }
        else {
            this.dom = this._proxyBuilder.build(config.properties);
            this._proxyBuilder.cache.store(this.type, this);
            return this;
        }
        
    },
    Prototype: {
        defaultProperties: {
            className: "proxy hidden",
            id: "proxydiv"
        },
        getDom: function(){
            return this.dom;
        },
        onDragstart: function(){
        
        },
        onHidden: function(){
            this.dom.className = "proxy hidden";
        },
        onSelect: function(e){
            this.dom.className = "proxy ondrag";
            this.dom.style.top = e.top + "px";
            this.dom.style.left = e.left + "px";
        },
        onMove: function(e){
            this.dom.style.top = e.top + "px";
            this.dom.style.left = e.left + "px";
        },
        finalize: function(){
            this._proxyBuilder.cache.remove(this.type);
            this.Super.finalize(this);
        },
        _proxyBuilder: j2j.effect.dnd.DragProxyBuilder.getInstance()
    },
    Extends: j2j.event.EventTarget
});
